<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/1/5
 * Time: 13:55
 */

namespace App\Http\Controllers\MiniProgram;


use App\Http\Logics\MiniProgram\PartnerLogic;
use App\Http\Traits\PartnerTrait;
use Illuminate\Http\Request;
use App\Http\Controllers\BaseController;
class PartnerController extends BaseController
{
    use PartnerTrait;

    /**
     * @SWG\Get(
     *     path="/partner/list",
     *     tags={"Partner"},
     *     description="getPartnerList",
     *     operationId="获取合作者列表",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="limit",
     *         in="query",
     *         description="分页大小",
     *         required=false,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Parameter(
     *         name="limit",
     *         in="query",
     *         description="合作者类型()",
     *         required=false,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getPartnerList(Request $request)
    {
        $limit = $this->limit;
        $type = $this->type;
        $data = [
            'limit' => $limit,
            'type' => $type
        ];
        $response = PartnerLogic::getPartnerList($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    /**
     * @SWG\Get(
     *     path="/partner/getDetailById",
     *     tags={"Partner"},
     *     description="getPartnerDetailById",
     *     operationId="获取合作者详情",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="partner_id",
     *         in="query",
     *         description="合作者ID",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function getPartnerDetailById()
    {
        $partner_id = $this->partner_id;
        $data = [
            'partner_id' => $partner_id
        ];
        $response = PartnerLogic::getPartnerDetailById($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }
}